package com.aacar.op.utils.pojo.select2;


import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.util.HashMap;
import java.util.Map;

/**
 * jQuery select2 option Json result
 * <p>
 * 注意:只输出非Null且非Empty(如List.isEmpty)的属性
 * </p>
 *
 * @author Gongle
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class OptResult extends OptgroupResult {

    public OptResult() {
    }

    public OptResult(String text, String id) {
        super(text);
        this.id = id;
    }

    private String id;
    private Boolean disabled; //此项是否可选
    private Boolean locked;   //此项是否锁定
    private Map attributes = new HashMap();   //附加属性

    @JsonIgnore
    public OptResult addAttribute(String key, Object val) {
        this.attributes.put(key, val);
        return this;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Boolean getDisabled() {
        return disabled;
    }

    public void setDisabled(Boolean disabled) {
        this.disabled = disabled;
    }

    public Boolean getLocked() {
        return locked;
    }

    public void setLocked(Boolean locked) {
        this.locked = locked;
    }

    public Map getAttributes() {
        return attributes;
    }

    public void setAttributes(Map attributes) {
        this.attributes = attributes;
    }
}
